<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>产品列表</title>
	<style>
		li{
			list-style: none;
		}
	</style>
</head>
<body>
	<ul>
		<li style="float: left;margin-right: 20px"><a href="ProductList">商品列表</a></li>
		<li style="float: left"><a href="addproduct.html">添加产品</a></li>
	</ul>
	<h1 align="center">产品列表</h1>
	<table border="2" align="center">
		<tr>
			<td>id</td>
			<td>名字</td>
			<td>价格</td>
			<td>描述</td>
			<td>图片</td>
			<td>产品类型</td>
			<td>操作</td>
		</tr>
		<c:forEach items="${Product.list}" var="product">
			<tr>
				<td>${product.id}</td>
				<td>${product.name}</td>
				<td>${product.price}</td>
				<td>${product.description}</td>
				<td>${product.ptype}</td>
				<td>${product.img}</td>
				<td><a href="DeleteProduct?id=${product.id}">删除</a>|<a href="ShowProductServlet?id=${product.id}">修改</a></td>
			</tr>
		</c:forEach>
	</table>
	<div style="margin-left: 370px; display: inline-block;">
		<c:choose>
			<c:when test="${Product.pageNum == 1 }">
			</c:when>
			<c:otherwise>
				<a href="AdminProduct?pageNum=1">首页</a>
				<a href="AdminProduct?pageNum=${Product.prePageNum }">上一页</a>
			</c:otherwise>
		</c:choose>
		<c:choose>
			<c:when test="${Product.pageNum == Product.totalPageNum }">
			</c:when>
			<c:otherwise>
				<a href="AdminProduct?pageNum=${Product.nextPageNum }">下一页</a>
				<a href="AdminProduct?pageNum=${Product.totalPageNum }">尾页</a>
			</c:otherwise>
		</c:choose>
		<a href="#" style="color: red;">一共有${Product.totalCount}条数据,当前是第${Product.pageNum }页</a>
	</div>


</body>
</html>